#ifndef TIME_SERIES_H_
#define TIME_SERIES_H_

#include "core/SpectrumComponent.h"

#include <vector>
#include <QtCore/QString>

namespace spectClean {

class TimeSeries
{
    public:
        /// Default constructor.
        TimeSeries();

        /// Destructor.
        virtual ~TimeSeries();

    public:
        /// Clear the time series data.
        void clear();

        /// Resize the time series.
        void resize(const unsigned n);

        /// Returns the number of entries in the time series.
        unsigned size() const { return _time.size(); }

        std::vector<double>& time() { return _time; }
        const std::vector<double>& time() const { return _time; }

        std::vector<double>& amp() { return _amp; }
        const std::vector<double>& amp() const { return _amp; }

    public:
        /// Load time series data from an ASCII file.
        int load(const QString& filename);

        void save(const QString& filename) const;

        void shift_times(const double offset);

        void generateEven(const unsigned nTimes, const double startTime,
                const double endTime,
                const std::vector<SpectrumComponent>& components);

        void generateRandom(const unsigned num_times, const double start_time,
                const double end_time,
                const std::vector<SpectrumComponent>& components);

        void mean(double& time, double& amp) const;

    private:
        std::vector<double> _time;
        std::vector<double> _amp;
};

} // namespace spectClean
#endif // TIME_SERIES_H_
